package be.teletask.onvif.requests;

import be.teletask.onvif.listeners.OnvifResponseListener;
import be.teletask.onvif.models.OnvifMediaProfile;
import be.teletask.onvif.models.OnvifType;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * Created by Luke F on 07/08/2020.
 */
@Getter
@NoArgsConstructor
public class MoveFocusRequest implements OnvifRequest {

    //Constants
    public static final String TAG = MoveFocusRequest.class.getSimpleName();

    //Attributes
    private OnvifResponseListener listener;
    private OnvifMediaProfile mediaProfile;
    private float continuousSpeed = 0f;

    //Constructors
    public MoveFocusRequest(OnvifMediaProfile mediaProfile, float continuousSpeed) {
        this.mediaProfile = mediaProfile;
        this.continuousSpeed = continuousSpeed;
    }

    public MoveFocusRequest(OnvifMediaProfile mediaProfile, float continuousSpeed, OnvifResponseListener listener) {
        this.mediaProfile = mediaProfile;
        this.continuousSpeed = continuousSpeed;
        this.listener = listener;
    }

    //Properties

    @Override
    public String getXml() {
        return "<Move xmlns=\"http://www.onvif.org/ver20/imaging/wsdl\">" +
                "<VideoSourceToken>" + mediaProfile.getVideoSourceToken() + "</VideoSourceToken>" +
                "<Focus xmlns=\"http://www.onvif.org/ver10/schema\">" +
                "<Continuous>" +
                "<Speed>"+continuousSpeed+"</Speed>" +
                "</Continuous>" +
                "</Focus>" +
                "</Move>";
    }

    @Override
    public OnvifType getType() {
        return OnvifType.MOVE_FOUCS;
    }

}
